<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html>
<html>
<head>
	<title>业务处理-库存预警</title>
	<meta charset="utf-8">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>libs/bootstrap-3.3.7-dist/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/reset.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/style.css">
	<link rel="stylesheet" type="text/css" href="<%=basePath %>css/iframe.css">
</head>
<body>
	<header id="mainHeader"></header>
	<div id="mainContent">
		<div id="mainContent_content">
			<div class="page_header"><a>库存预警</a></div>
			<div class="search">
			<form action="<%=basePath %>inventory/inventoryIteminfo.do" method="post" class="form">
				<input type="hidden" name="currentPage" value="1">
				<p>
					<label>物品代码</label>
					<input type="text" class="form-control" name="itemCode" value="${inventoryWarningPage.itemCode }"></input>
					<label>物品名称</label>
					<input type="text" class="form-control" name="chineseName" value="${inventoryWarningPage.chineseName }"></input>
					<label>所属分类</label>
					<select name="categoryId" class="form-control select">
						<option value="">全部</option>
						<c:forEach items="${categoryList }" var="cat">
						<option value="${cat.categoryid }" <c:if test="${inventoryWarningPage.categoryId==cat.categoryid}">selected</c:if>>${cat.categoryname }</option>
						</c:forEach>
					</select>
					<label>物料类型</label>
					<select name="materialMaterial" class="form-control select">
						<option value="">全部</option>
						<option value="普通物料" <c:if test="${inventoryWarningPage.materialMaterial=='普通物料'}">selected</c:if>>普通物料</option>
						<option value="IMPA物料" <c:if test="${inventoryWarningPage.materialMaterial=='IMPA物料'}">selected</c:if>>IMPA物料</option>	
					</select>
				</p>
				<p>
					<label>预警类型</label>
					<select name="warningType"  class="form-control select">
						<option value="">全部</option>
						<option value="库存不足" <c:if test="${inventoryWarningPage.warningType=='库存不足'}">selected</c:if>>库存不足</option>
						<option value="库存过多" <c:if test="${inventoryWarningPage.warningType=='库存过多'}">selected</c:if>>库存过多</option>	
					</select>
					<span class="btn">
						<input type="submit" class="btn btn1" value="搜索"></input>
						<input type="button" class="btn btn2" value="清空" onclick="clearSearchParam();"></input>
						<input type="button" class="btn btn1" value="下载PDF" onclick="window.open('<%=basePath %>inventory/downloadStorageWarning.do?itemCode=${inventoryWarningPage.itemCode }');"></input>
					</span>
				</p>
			</form>
			</div>
			<div class="tableBox box">
				<table class="table table-bordered table_text_center">
					<thead>
						<tr>
							<th>序号</th>
							<th>物品代码</th>
							<th>物品名称</th>
							<th>物品条码</th>
							<th>所属分类</th>
							<th>物料类型</th>
							<th>库存上限</th>
							<th>库存下限</th>
							<th>当前库存</th>
							<th>单位</th>
							<th>预警类型</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${inventoryList }" var="inven" varStatus="ids">
							<tr>
								<td>${ids.count + (inventoryWarningPage.currentPage * inventoryWarningPage.pageSize - inventoryWarningPage.pageSize)}</td>
								<td>${inven.itemcode }</td>
								<td>${inven.chinesename }</td>
								<td>${inven.articlebarcode }</td>
								<td>${inven.categoryName }</td>
								<td>${inven.materialmaterial }</td>
								<td>${inven.maxstock }</td>
								<td>${inven.minstock }</td>
								<td>${inven.currentstock }</td>
								<td>${inven.purchasingunit }</td>
								<td style="color:<c:if test="${inven.currentstock>inven.maxstock}">green;</c:if><c:if test="${inven.currentstock<inven.minstock}">red;</c:if>">${inven.currentstock>inven.maxstock?"库存过多":inven.currentstock<inven.minstock?"库存不足":"" }</td>
							</tr>
						</c:forEach>
					</tbody>
				</table>
			</div>
			<jsp:include page="/jsp/basic/page.jsp"></jsp:include>
		</div>
		<jsp:include page="/jsp/basic/prompt.jsp"></jsp:include>
	</div>
	<script src="<%=basePath %>js/jquery-3.2.1.min.js"></script>
	<script src="<%=basePath %>libs/bootstrap-3.3.7-dist/js/bootstrap.js"></script>
	<script src="<%=basePath %>My97DatePickers/WdatePicker.js"></script>
	<script src="<%=basePath %>js/public.js"></script>
	<script type="text/javascript">
		function clearSearchParam(){
			$(".search input:text").val("");
			$(".search select").val("");
		}
	</script>
</body>
</html>